package com.vf.admin.client.dao;

import com.vf.admin.common.db.BaseDao;
import com.vf.admin.miaodong.entity.AppUserSetting;
import org.springframework.stereotype.Repository;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

@Repository
public class AppUserSettingDao extends BaseDao<AppUserSetting> {

    public AppUserSetting getByUserId(Integer userId) {
        String sql = "select * from app_user_setting where userId="+userId;

        return this.queryObj(sql, null, AppUserSetting.class);
    }

    public void delByUserId(Integer userId) {
        String sql = "delete from app_user_setting where userId="+userId;

        this.del(sql, null);
    }

    public List<Map> getUserIdsByHiddenArea() {
        String sql = "SELECT s.userId FROM app_user_setting s left join app_user u on s.userId=u.id where s.hiddenArea=3";

        return this.queryList(sql, null, Map.class);
    }

    public List<Map> getUserIdsByHiddenRank() {
        String sql = "SELECT s.userId FROM app_user_setting s left join app_user u on s.userId=u.id where s.hiddenRank=1";

        return this.queryList(sql, null, Map.class);
    }
}
